#include <cstring>
#include <string>
#include "vl_props.h"

using namespace VL;

int main(int argc, const char** argv) {
	if(argc != 2) {
		return 1;
	}

	VLProp prop;
	try {
		VLProp::readVLP(argv[1], prop);
		if(!prop.isMap()) {
			return 3;
		}
		auto & aMap = prop["A"];
		if(!aMap.isMap()) {
			return 4;
		}
		auto & aArr = aMap["a"];
		if(!aArr.isArray()) {
			return 5;
		}
		if(aArr.size() != 2) {
			return 6;
		}
		if(aArr[0].intValue() != 1) {
			return 7;
		}
		if(aArr[1].intValue() != 2) {
			return 8;
		}
		auto & bArr = aMap["b"];
		if(!bArr.isArray()) {
			return 9;
		}
		if(bArr.size() != 2) {
			return 10;
		}
		if(bArr[0].intValue() != 1) {
			return 11;
		}
		if(bArr[1].intValue() != 2) {
			return 12;
		}
		auto & cArr = aMap["c"];
		if(!cArr.isArray()) {
			return 13;
		}
		if(cArr.size() != 2) {
			return 14;
		}
		if(cArr[0].intValue() != 1) {
			return 15;
		}
		if(cArr[1].intValue() != 2) {
			return 16;
		}

		return 0;
	} catch(const VLPropExcetion& exception) {
		printf("error: %s\n", exception.message.c_str());
		return 2;
	} catch(...) {
		return 2;
	}

	return 0;
}